﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace msBsc.WebUi.mMall.Buyer
{
    public partial class mfSystemMess : msBsc.Cls.mBPUser
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public override void DoAction()
        {
            if (this.strAction == "init")
            {
                getSysMessage();
            }
        }

        private void getSysMessage()
        {
            string msgId = this.GetParamHtValue("msgId");

            if (string.IsNullOrEmpty(msgId))
            {
                this.ExecJScript(@"window.location.href = "" /mb_SystemMessList.htm "";");
                return;
            }
            string djackId = msBsc.SvRef.UserInfo.Operator;
            if (string.IsNullOrEmpty(djackId))
            {
                this.ExecJScript(@"window.location.reload(true);");
                return;
            }
            using (msBsc.AppLogic.DataAlc.CBizMessageSystem sysMsg = new AppLogic.DataAlc.CBizMessageSystem())
            {
                DataSet ds = sysMsg.GetMsgInfo(msgId, djackId);
                if (ds == null || ds.Tables[0].Rows.Count < 1)
                {
                    return;
                }
                string upRet = sysMsg.UpdateStatus(ds, 1);
                if (upRet!="OK")
                {
                    this.Alert("修改消息状态失败");
                }
                string ret = msBsc.AppLogic.Cfg.HttpTools.GetJsonByTable(ds.Tables[0], "", "", 1, 1000, "");
                this.ExecJScript(@"setMessage(" + ret + ")");
            }
        }
    }
}